package com.wwp.tbshop.presenter;


import android.content.Context;

import com.wwp.tbshop.activity.SearchActivity;
import com.wwp.tbshop.model.bean.KeywordBean;

import java.util.List;

import retrofit2.Call;

/**
 * Created by Xiaokun on 2017/6/18.
 */

public class RecommendSearchPresenter extends BasePresenter<KeywordBean>{

    private Context mContext;

    public RecommendSearchPresenter(Context context){
        this.mContext=context;
    }

    public void getKeyword(){
        Call<KeywordBean> keyword = mApiService.getKeyword();
        keyword.enqueue(mCallback);
    }


    @Override
    protected void onServerBug(int code) {

    }

    @Override
    protected void onConnectError(String message) {

    }

    @Override
    protected void onSuccess(KeywordBean keywordBean) {
        if (keywordBean!=null){
            List<String> searchKeywords = keywordBean.getSearchKeywords();
            ((SearchActivity) mContext).setData(searchKeywords);
        }
    }
}
